home *** CD-ROM | disk | FTP | other *** search
/ Safarir 3 / SafTV-CD3.iso / pc / Bonus / Dessins Animés / static / jeux / hache_humourhumour.swf / scripts / frame_12 / DoAction.as
Text File  |  2002-03-05  |  5KB  |  286 lines

  1. function mouv_support()
  2. {
  3.    if(0 < bonus)
  4.    {
  5.       bonus -= 10;
  6.    }
  7.    if(supportDepla == "db")
  8.    {
  9.       perso._x += 1;
  10.       perso._y += 1;
  11.    }
  12.    if(supportDepla == "dh")
  13.    {
  14.       perso._x += 1;
  15.       perso._y -= 1;
  16.    }
  17.    if(supportDepla == "gh")
  18.    {
  19.       perso._x -= 1;
  20.       perso._y -= 1;
  21.    }
  22.    if(supportDepla == "gb")
  23.    {
  24.       perso._x -= 1;
  25.       perso._y += 1;
  26.    }
  27. }
  28. function directViseur()
  29. {
  30.    if(Key.isDown(Key.RIGHT))
  31.    {
  32.       if(depla == "gg")
  33.       {
  34.          depla = "dd";
  35.       }
  36.       else if(depla == "hd")
  37.       {
  38.          depla = "dd";
  39.       }
  40.       else if(depla == "bd")
  41.       {
  42.          depla = "dd";
  43.       }
  44.       else if(depla == "hh")
  45.       {
  46.          depla = "hd";
  47.       }
  48.       else if(depla == "hg")
  49.       {
  50.          depla = "hh";
  51.       }
  52.       else if(depla == "bb")
  53.       {
  54.          depla = "bd";
  55.       }
  56.       else if(depla == "bg")
  57.       {
  58.          depla = "bb";
  59.       }
  60.    }
  61.    else if(Key.isDown(Key.LEFT))
  62.    {
  63.       if(depla == "dd")
  64.       {
  65.          depla = "gg";
  66.       }
  67.       else if(depla == "hg")
  68.       {
  69.          depla = "gg";
  70.       }
  71.       else if(depla == "bg")
  72.       {
  73.          depla = "gg";
  74.       }
  75.       else if(depla == "hh")
  76.       {
  77.          depla = "hg";
  78.       }
  79.       else if(depla == "hd")
  80.       {
  81.          depla = "hh";
  82.       }
  83.       else if(depla == "bb")
  84.       {
  85.          depla = "bg";
  86.       }
  87.       else if(depla == "bd")
  88.       {
  89.          depla = "bb";
  90.       }
  91.    }
  92.    else if(Key.isDown(Key.UP))
  93.    {
  94.       if(depla == "bb")
  95.       {
  96.          depla = "hh";
  97.       }
  98.       else if(depla == "hg")
  99.       {
  100.          depla = "hh";
  101.       }
  102.       else if(depla == "hd")
  103.       {
  104.          depla = "hh";
  105.       }
  106.       else if(depla == "dd")
  107.       {
  108.          depla = "hd";
  109.       }
  110.       else if(depla == "bd")
  111.       {
  112.          depla = "dd";
  113.       }
  114.       else if(depla == "gg")
  115.       {
  116.          depla = "hg";
  117.       }
  118.       else if(depla == "bg")
  119.       {
  120.          depla = "gg";
  121.       }
  122.    }
  123.    else if(Key.isDown(Key.DOWN))
  124.    {
  125.       if(depla == "hh")
  126.       {
  127.          depla = "bb";
  128.       }
  129.       else if(depla == "bg")
  130.       {
  131.          depla = "bb";
  132.       }
  133.       else if(depla == "bd")
  134.       {
  135.          depla = "bb";
  136.       }
  137.       else if(depla == "dd")
  138.       {
  139.          depla = "bd";
  140.       }
  141.       else if(depla == "hd")
  142.       {
  143.          depla = "dd";
  144.       }
  145.       else if(depla == "gg")
  146.       {
  147.          depla = "bg";
  148.       }
  149.       else if(depla == "hg")
  150.       {
  151.          depla = "gg";
  152.       }
  153.    }
  154. }
  155. function deplaViseur()
  156. {
  157.    if(depla == "hh")
  158.    {
  159.       viseur._y -= 5;
  160.    }
  161.    if(depla == "hd")
  162.    {
  163.       viseur._x += 5;
  164.       viseur._y -= 5;
  165.    }
  166.    if(depla == "dd")
  167.    {
  168.       viseur._x += 5;
  169.    }
  170.    if(depla == "bd")
  171.    {
  172.       viseur._x += 5;
  173.       viseur._y += 5;
  174.    }
  175.    if(depla == "bb")
  176.    {
  177.       viseur._y += 5;
  178.    }
  179.    if(depla == "bg")
  180.    {
  181.       viseur._x -= 5;
  182.       viseur._y += 5;
  183.    }
  184.    if(depla == "gg")
  185.    {
  186.       viseur._x -= 5;
  187.    }
  188.    if(depla == "hg")
  189.    {
  190.       viseur._x -= 5;
  191.       viseur._y -= 5;
  192.    }
  193.    if(viseur._x < 40)
  194.    {
  195.       viseur._x = 599;
  196.    }
  197.    if(600 < viseur._x)
  198.    {
  199.       viseur._x = 41;
  200.    }
  201.    if(viseur._y < 20)
  202.    {
  203.       viseur._y = 378;
  204.    }
  205.    if(380 < viseur._y)
  206.    {
  207.       viseur._y = 21;
  208.    }
  209. }
  210. function lancer()
  211. {
  212.    if(perso._currentframe < 10)
  213.    {
  214.       if(Key.isDown(Key.SPACE))
  215.       {
  216.          if(reste == 1 and 5 < hache2._currentframe)
  217.          {
  218.             reste = 0;
  219.             hache1.gotoAndPlay("tir");
  220.             hache1._x = viseur._x;
  221.             hache1._y = viseur._y;
  222.          }
  223.          if(reste == 2 and 5 < hache3._currentframe)
  224.          {
  225.             reste = 1;
  226.             hache2.gotoAndPlay("tir");
  227.             hache2._x = viseur._x;
  228.             hache2._y = viseur._y;
  229.          }
  230.          if(reste == 3 and 5 < hache4._currentframe)
  231.          {
  232.             reste = 2;
  233.             hache3.gotoAndPlay("tir");
  234.             hache3._x = viseur._x;
  235.             hache3._y = viseur._y;
  236.          }
  237.          if(reste == 4 and 5 < hache5._currentframe)
  238.          {
  239.             reste = 3;
  240.             hache4.gotoAndPlay("tir");
  241.             hache4._x = viseur._x;
  242.             hache4._y = viseur._y;
  243.          }
  244.          if(reste == 5)
  245.          {
  246.             reste = 4;
  247.             hache5.gotoAndPlay("tir");
  248.             hache5._x = viseur._x;
  249.             hache5._y = viseur._y;
  250.          }
  251.       }
  252.    }
  253. }
  254. function dispo(nom)
  255. {
  256.    if(5 < nom._currentframe)
  257.    {
  258.       if(supportDepla == "db")
  259.       {
  260.          nom._x += 1;
  261.          nom._y += 1;
  262.       }
  263.       if(supportDepla == "dh")
  264.       {
  265.          nom._x += 1;
  266.          nom._y -= 1;
  267.       }
  268.       if(supportDepla == "gh")
  269.       {
  270.          nom._x -= 1;
  271.          nom._y -= 1;
  272.       }
  273.       if(supportDepla == "gb")
  274.       {
  275.          nom._x -= 1;
  276.          nom._y += 1;
  277.       }
  278.    }
  279. }
  280. supportDepla = "db";
  281. depla = "dd";
  282. reste = 5;
  283. bonus = 5000;
  284. score = 0;
  285. tirs = 0;
  286.